{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "b4bb06bd",
   "metadata": {},
   "source": [
    "\n",
    "# Game Activity Event Planner\n",
    "\n",
    "This notebook demonstrates AgentNeo's ability to:\n",
    "1. Search for locations where badminton is played.\n",
    "2. Find nearby locations based on user input.\n",
    "3. Filter locations based on weekends and specific time slots (6-8 PM).\n",
    "4. Book 2 courts for singles or doubles matches.\n",
    "\n",
    "### Use Case\n",
    "A group of 6 players wants to book 2 courts to play badminton during the weekend (6-8 PM). This notebook tests the AgentNeo application for its planning functionality.\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6e6913d5",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "# Install necessary packages\n",
    "!pip install agentneo\n",
    "\n",
    "# Import required libraries\n",
    "from agentneo import Planner, LocationFinder, CourtBooking\n",
    "import datetime\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "221625df",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "# Define user input and search parameters\n",
    "\n",
    "# User's current location (latitude, longitude)\n",
    "user_location = {\"latitude\": 37.7749, \"longitude\": -122.4194}  # Example: San Francisco\n",
    "\n",
    "# Time and date filtering for the weekend\n",
    "today = datetime.date.today()\n",
    "weekend_days = [today + datetime.timedelta(days=(5 - today.weekday()) % 7 + i) for i in range(2)]\n",
    "\n",
    "time_slot = {\"start\": \"18:00\", \"end\": \"20:00\"}  # 6-8 PM\n",
    "\n",
    "# Number of players and courts required\n",
    "num_players = 6\n",
    "num_courts = 2\n",
    "\n",
    "print(\"Search Parameters Defined:\")\n",
    "print(f\"User Location: {user_location}\")\n",
    "print(f\"Weekend Days: {weekend_days}\")\n",
    "print(f\"Time Slot: {time_slot}\")\n",
    "print(f\"Players: {num_players}, Courts: {num_courts}\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a38c6e7d",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "# Find locations where badminton is played\n",
    "location_finder = LocationFinder()\n",
    "\n",
    "# Search for badminton locations nearby\n",
    "badminton_locations = location_finder.find_locations(activity=\"badminton\", \n",
    "                                                      user_location=user_location, \n",
    "                                                      max_distance=10)  # Within 10 km\n",
    "\n",
    "print(\"Available Badminton Locations Found:\")\n",
    "for loc in badminton_locations:\n",
    "    print(loc)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "6fdadfd7",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "# Filter locations for weekends and the specified time slot\n",
    "available_locations = []\n",
    "\n",
    "for loc in badminton_locations:\n",
    "    if location_finder.is_available(location=loc, days=weekend_days, time_slot=time_slot):\n",
    "        available_locations.append(loc)\n",
    "\n",
    "print(\"Filtered Locations for Weekends and 6-8 PM:\")\n",
    "for loc in available_locations:\n",
    "    print(loc)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "19775831",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "# Book 2 courts for singles or doubles matches\n",
    "court_booking = CourtBooking()\n",
    "\n",
    "if available_locations:\n",
    "    booking_details = court_booking.book_courts(location=available_locations[0], \n",
    "                                                 num_courts=num_courts, \n",
    "                                                 players=num_players, \n",
    "                                                 time_slot=time_slot)\n",
    "    print(\"Court Booking Details:\")\n",
    "    print(booking_details)\n",
    "else:\n",
    "    print(\"No suitable locations found for booking.\")\n"
   ]
  }
 ],
 "metadata": {},
 "nbformat": 4,
 "nbformat_minor": 5
}
